#include <iostream>
using namespace std;

class Sample
{
public:
    int x;
    int y;
    void disp()
    {
        cout << "x = " << x << endl;
        cout << "y = " << y << endl;
    }
};

int main()
{
    int Sample ::*p1;
    Sample s;
    p1 = &Sample::x; // p1指向x的地址
    s.*p1 = 10;
    p1 = &Sample::y;
    s.*p1 = 20;

    s.disp();
}